<?php
/**
 * Date: 10/21/12
 * Time: 11:29 PM
 * User: Amitav Roy
 */
class User extends CI_Controller {
	function __construct() {
		parent::__construct();

		// Loading the user model.
		$this->load->model('user_m','user');
	}

  /**
   * Index page is not used directly. User will be redirected to login page.
   */
	function index() {
		redirect('user/login');
	}

	/**
	 * This is the login page for the user.
	 * This will render the form only, the main logic
	 * is inside do_login.
	 */
	function login() {
		$data['pagetitle'] = 'Login to enter the application';
		$data['subheading'] = 'Login - Money Manager 2';
		$data['no_nav'] = true; // This is done only for the login screen.
		$data['viewname'] = 'login_v.php';
		$data['viewdata'] = 'A';

		$this->load->view('master', $data);
	}

	/**
	 * This is where the user is redirected to when he fills the login form.
	 * This will take care of the user's login details and redirect
	 * as per the credentials.
	 */
	function do_login() {
		$auth = $this->user->user_auth();
	}

  /**
   * This page will destroy the session 
   * and logout the user, and then redirect to the login page.
   */
	function logout() {
		$this->session->sess_destroy();
		redirect('user/index');
	}
}

/* End of file user.php */
/* Location: ./application/modules/users/user.php */